<?php 
defined('RUN_KATANA') or die('Restricted access'); 
require('auto.js.php');
$adc->getUserAds();
?>
<form method="get" id="search-ad-form" action="<?php echo $katana->getFormAction(); ?>">
	<div class="prospector list edit">
		<div class="prospect-list">
			<div class="prospect-list-padding">
			<?php 
			if(is_file($adc->getViewPath().'SorterAdEdit.php'))
			{ require($adc->getViewPath().'SorterAdEdit.php'); }
			else
			{ require($adc->getViewPath().'Sorter.php'); }
			?><hr /><?php
			if(count($adc->getAds()) > 0)
			{
				$i = 0;
				foreach($adc->getAds() as $ad)
				{
					$go = 0;
					if(($_REQUEST['status'] == 0) && ($ad->getActive() == 0) && ($ad->getArchived() == 0))
					{ $go = 1; }
					if(($_REQUEST['status'] == 1) && ($ad->getActive() == 1) && ($ad->getArchived() == 0) && (strtotime($ad->getDateActiveEnd()) > time()))
					{ $go = 1; }
					if(($_REQUEST['status'] == 2) && 
					   ($ad->getDateActiveStart() != '0000-00-00 00:00:00') && 
					   ($ad->getDateActiveEnd() != '0000-00-00 00:00:00') && 
					   (($ad->getArchived() == 1) || (strtotime($ad->getDateActiveEnd()) < time())
					  ))
					{ $go = 1; }
					if(($_REQUEST['status'] == '-1') || ($_REQUEST['status'] == '')) 
					{ $go = 1; }
					
					if($go > 0)
					{
						if(is_file($adc->getViewPath().get_class($ad).'Item.php'))
						{ require($adc->getViewPath().get_class($ad).'Item.php'); }
						else
						{
							if(is_file($adc->getViewPath().'AdItem.php'))
							{ require($adc->getViewPath().'AdItem.php'); }
						}
						echo '<div class="clear"></div><hr />';
					}
					$i++;
				}
			}
			else
			{ echo $adc->getSetting('NoHitsTxt'); }
			?>
			</div>
		</div>
		<div class="clear"></div>
	</div>
	<input type="hidden" name="list" value="ad" />
</form>